#include<iostream>
#include<cstring>
using namespace std;
class my {
private:
	char name[21];
	int blood;
	int damage;
	int defence;
	char type;
	int grade;
public:
	void print();
	void set(char* name, char type, int grade);
	int getblood();
	int getdamage();
	int getdefence();
	int getgrade();
	char gettype();
	char* getname();
	bool shift(char c);
};
void my::set(char*n,char t,int g) {
	for (int i = 0; i < strlen(n); i++) {
		name[i] = n[i];
	}
	name[strlen(n)] = 0;
	type = t;
	grade = g;
	blood = 5 * grade;
	damage = 5 * grade;
	defence = 5 * grade;
	if (type == 'A') {
		damage *= 2;
	}
	if (type == 'D') {
		defence *= 2;
	}
	if (type == 'H') {
		blood *= 10;
	}
}
void my::print() {
	cout << name << "--" << type << "--" << grade << "--" << blood << "--" << damage << "--" << defence << endl;
}
int my::getblood() {
	return blood;
}
int my::getdamage() {
	return damage;
}
int my::getdefence() {
	return defence;
}
int my::getgrade() {
	return grade;
}
char* my::getname() {
	return name;
}
char my::gettype() {
	return type;
}
bool my::shift(char c) {
	if (c == type) {
		return false;
	}
	if (type == 'A') {
		damage /= 2;
	}
	if (type == 'D') {
		defence /= 2;
	}
	if (type == 'H') {
		blood /= 10;
	}
	type = c;
	if (type == 'A') {
		damage *= 2;
	}
	if (type == 'D') {
		defence *= 2;
	}
	if (type == 'H') {
		blood *= 10;
	}
	return true;
}
int main()
{
	int t;
	cin >> t;
	int num = 0;
	for (int i = 0; i < t; i++) {
		char name[21];
		char type;
		int grade;
		cin >> name >> type >> grade;
		my hui;
		hui.set(name, type, grade);
		char c;
		cin >> c;
		int n=hui.shift(c);
		if (n) {
			num++;
		}
		hui.print();
	}
	cout << "The number of robot transform is " << num << endl;
	return 0;
}